'''
作业
'''
# 1.
stu = {'name': '', 'age': 20, 'score': 89, 'tel': '', 'gender': ''}

# 2.
all_stu = [
    {'name': 'xm', 'age': 22, 'score': 89, 'tel': '124532132', 'gender': '1'},
    {'name': 'xh', 'age': 20, 'score': 60, 'tel': '13548', 'gender': '0'},
    {'name': 'ah', 'age': 16, 'score': 56, 'tel': '6543543', 'gender': '1'},
    {'name': 'lh', 'age': 19, 'score': 45, 'tel': '5463123', 'gender': '0'},
    {'name': 'ls', 'age': 25, 'score': 90, 'tel': '1318', 'gender': '1'},
    {'name': 'zs', 'age': 17, 'score': 95, 'tel': '165443', 'gender': '3'}
]
# a
count = 0
for stu in all_stu:
    if stu['score'] < 60:
        count += 1
print('不及格人数：', count)
# b
for stu in all_stu:
    if stu['score'] < 60:
        name = stu['name']
        score = stu['score']
        print('不及格学生姓名{}，分数{}：'.format(name, score))
# c
count = 0
for stu in all_stu:
    if stu['age'] < 18:
        count += 1
print('未成年人数：', count)
# d
for stu in all_stu:
    if stu['tel'][-1] == '8':
        print(stu['name'])
# e

max_s = 0
for stu in all_stu:
    if stu['score'] > max_s:
        max_s = stu['score']
        name = stu['name']
print('最高分{}，学生：{}'.format(max_s, name))
# f

for x in range(len(all_stu)):
    for y in range(x + 1, len(all_stu)):
        if all_stu[x]['score'] < all_stu[y]['score']:
            all_stu[x], all_stu[y] = all_stu[y], all_stu[x]
for stu in all_stu:
    print(stu['score'])
# g

for stu in all_stu:
    if stu['gender'] == '3':
        all_stu.remove(stu)
for stu in all_stu:
    print(stu['name'])
# 3.
students1 = ['s1', 's2', 's5']
students2 = ['s1', 's2', 's3', 's6']
students3 = ['s1', 's3', 's4']
# a

all1 = students1+students2+students3
a_stu = set(all1)
count = 0
for stu in a_stu:
    count += 1
print(count)
# b
all2 = students2+students3
a = set(students1) - set(all2)
count = 0
for s in a:
    count += 1
print('人数{}，名字{}'.format(count, a))
# c
stu1 = set(students1) & set(students2) & set(students3)
stu2 = set(students1) ^ set(students2) ^ set(students3)
for stu in stu1:
    stu2.remove(stu)
count = 0
for stu in stu2:
    count += 1
print('数量{}，名字：{}'.format(count, stu2))
# d
a = set(students1) & set(students2) - set(students3)
b = set(students1) & set(students3) - set(students2)
c = set(students2) & set(students3) - set(students1)
list1 = list(a) + list(b) + list(c)
count = 0
for stu in list1:
    count += 1
print('数量：{}，学生：{}'.format(count,list1))
# e
stu1 = set(students1) & set(students2) & set(students3)
count = 0
for stu in stu1:
    count += 1
print('数量{}，名字：{}'.format(count, stu1))
